﻿namespace Digitalmes.Domain.Mes;

/// <summary>
/// 工序信息
/// </summary>
/// <remarks></remarks>
[SugarTable("proc_process", "工序信息表")]
public class ProcProcess : EntityBase
{
    /// <summary>
    /// 工序编号
    /// </summary>
    [NotNull]
    [SugarColumn(ColumnDescription = "工序编号", Length = 32)]
    public string? ProcCode { get; set; }

    /// <summary>
    /// 工序名称
    /// </summary>
    [NotNull]
    [SugarColumn(ColumnDescription = "工序名称", Length = 32)]
    public string? ProcName { get; set; }

    /// <summary>
    /// 产线 Id
    /// </summary>
    [SugarColumn(ColumnDescription = "产线Id")]
    public long LineId { get; set; }

    [Navigate(NavigateType.OneToOne, nameof(LineId))]
    public MdLine? Line { get; set; }

    /// <summary>
    /// 产线编码
    /// </summary>
    [NotNull]
    [SugarColumn(ColumnDescription = "产线编码", Length = 32)]
    public string? LineCode { get; set; }

    /// <summary>
    /// 工位 Id 集合。
    /// </summary>
    /// <remarks>某些工位是并行执行的，所以某一工序也可以对应多个工位。</remarks>
    [NotNull]
    [SugarColumn(ColumnDescription = "工位Id集合", IsJson = true, Length = 256)]
    public long[]? OpIds { get; set; }

    /// <summary>
    /// 工位编号集合，对应工位 Id 集合。
    /// </summary>
    [NotNull]
    [SugarColumn(ColumnDescription = "工位编号集合", IsJson = true, Length = 256)]
    public string[]? OpCodes { get; set; }

    /// <summary>
    /// 工艺分类（装配/检测/返工）
    /// </summary>
    [SugarColumn(ColumnDescription = "工艺分类")]
    public ProcClassifyEnum Classify { get; set; }

    /// <summary>
    /// 工艺类型编号
    /// </summary>
    [NotNull]
    [SugarColumn(ColumnDescription = "工艺类型", Length = 32)]
    public string? ProcTypeCode { get; set; }

    /// <summary>
    /// 工艺类型名称（如 弧焊、拉铆、拧紧、拍照、气密等）
    /// </summary>
    [NotNull]
    [SugarColumn(ColumnDescription = "工艺类型", Length = 32)]
    public string? ProcTypeName { get; set; }

    /// <summary>
    /// 是否禁用
    /// </summary>
    [SugarColumn(ColumnDescription = "是否禁用")]
    public bool IsDisabled { get; set; }
}
